import React, {PureComponent} from "react"
import {bindActionCreators} from "redux"
import {connect} from "react-redux"


/*css依赖*/
import "./style.less"

/*ant 组件*/
import {Input, Button, Icon, Table } from "antd"
const Search = Input.Search;



/*redux连接池*/
@connect(
    ({state}) => ({

    }),
    (dispatch) => (
      bindActionCreators({

      }, dispatch)
    )
)
export default class DataFile extends PureComponent {
  state = {

  }

  render() {
    const {} = this.props;
    const {} = this.state;
    const columns = [{
      title: '类型',
      dataIndex: 'type',
      render: text => {
        return(
          <a href="#" style={{color:"#000"}}><Icon type="file-text" style={{color:"#00b295",marginRight:'5px'}}/>{text}</a>
        )
      },
    }, {
      title: '大小',
      dataIndex: 'size',
    }, {
      title: '上传人',
      dataIndex: 'person',
    },{
      title: '时间',
      dataIndex: "times"
    },{
      title:"",
      render:(data)=>{
        return (
          <div className="tableHandle">
            <Icon type="download" onClick={()=>this.download(data)}/>
            <Icon type="delete"   onClick={()=>this.delete(data)}/>
          </div>
          )
      }
    }];
    const data = [{
      key: '1',
      size:'20KB',
      type: '上报材料',
      person: '陈胜云',
      times: '2017-5-3 11:20',
    }];
    const rowSelection = {
      onChange: (selectedRowKeys, selectedRows) => {
        console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
      },
      getCheckboxProps: record => ({
      }),
    };
    return (
      <div className="pointDetails-log">
        <div className="pointDetails-log-title">
            <h4>全部文件</h4>
            <Search 
              style={{width:"200px"}}
              placeholder="搜索文件"
              onSearch={value => console.log(value)}
            />
        </div>
        <Table rowSelection={rowSelection} columns={columns} dataSource={data} />
      </div>
    )
  }
  componentDidMount() {

  }
  download = (data) => {
    console.log(data);
  }

  delete = (data) => {
    console.log(data)
  }
}
